/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2009 - 2012 Luca Mingardi.
 *
 * This file is part of jeeObserver.
 *
 * JeeObserver is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * JeeObserver is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
package jeeobserver.server.settings;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * The Class Settings.
 *
 * @author Luca Mingardi
 * @version 4.0
 */
@XmlRootElement
public final class Settings implements Serializable {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 40L;

	/** The jsf observer enabled. */
	private boolean jsfObserverEnabled;

	/** The ejb observer enabled. */
	private boolean ejbObserverEnabled;

	/** The servlet observer enabled. */
	private boolean servletObserverEnabled;

	/** The custom observer enabled. */
	private boolean customObserverEnabled;

	/** The http session observer enabled. */
	private boolean httpSessionObserverEnabled;

	/** The jvm observer enabled. */
	private boolean jvmObserverEnabled;

	/** The hard disk observer enabled. */
	private boolean hardDiskObserverEnabled;

	/** Theaction exclusion rules list. */
	private List<ActionExclusionRule> actionExclusionRulesList;

	/** Theaction notification rules list. */
	private List<ActionNotificationRule> actionNotificationRulesList;

	/** The jvm exclusion rules list. */
	private List<JvmExclusionRule> jvmExclusionRulesList;

	/** The jvm notification rules list. */
	private List<JvmNotificationRule> jvmNotificationRulesList;

	/** The http session exclusion rules list. */
	private List<HttpSessionExclusionRule> httpSessionExclusionRulesList;

	/** The http session notification rules list. */
	private List<HttpSessionNotificationRule> httpSessionNotificationRulesList;

	/** The hard disk exclusion rules list. */
	private List<HardDiskExclusionRule> hardDiskExclusionRulesList;

	/** The hard disk notification rules list. */
	private List<HardDiskNotificationRule> hardDiskNotificationRulesList;

	/** Theaction max storage period. */
	private TimePeriod actionMaxStoragePeriod;

		/** The http session max storage period. */
	private final TimePeriod jvmMaxStoragePeriod;

	/** The http session max storage period. */
	private final TimePeriod httpSessionMaxStoragePeriod;

	/** The hard disk max storage period. */
	private TimePeriod hardDiskMaxStoragePeriod;

	/** The tables optimization schedule. */
	private TimeSchedule tablesOptimizationSchedule;

	/** The tables clean schedule. */
	private TimeSchedule tablesCleanSchedule;

	/** The smtp connection. */
	private SmtpConnection smtpConnection;

	/**
	 * Instantiates a new settings.
	 */
	public Settings() {

		this.jsfObserverEnabled = true;
		this.ejbObserverEnabled = true;
		this.servletObserverEnabled = true;
		this.customObserverEnabled = true;

		this.httpSessionObserverEnabled = true;

		this.jvmObserverEnabled = true;

		this.hardDiskObserverEnabled = true;

		this.actionExclusionRulesList = new ArrayList<ActionExclusionRule>();
		this.actionNotificationRulesList = new ArrayList<ActionNotificationRule>();

		this.jvmExclusionRulesList = new ArrayList<JvmExclusionRule>();
		this.jvmNotificationRulesList = new ArrayList<JvmNotificationRule>();

		this.httpSessionExclusionRulesList = new ArrayList<HttpSessionExclusionRule>();
		this.httpSessionNotificationRulesList = new ArrayList<HttpSessionNotificationRule>();

		this.hardDiskExclusionRulesList = new ArrayList<HardDiskExclusionRule>();
		this.hardDiskNotificationRulesList = new ArrayList<HardDiskNotificationRule>();

		this.actionMaxStoragePeriod = new TimePeriod(TimePeriod.UNIT_MONTH, 3);
		this.jvmMaxStoragePeriod = new TimePeriod(TimePeriod.UNIT_DAY, 7);
		this.httpSessionMaxStoragePeriod = new TimePeriod(TimePeriod.UNIT_MONTH, 3);
		this.hardDiskMaxStoragePeriod = new TimePeriod(TimePeriod.UNIT_MONTH, 1);

		this.tablesCleanSchedule = new MinuteSchedule(new int[] { 0, 10, 20, 30, 40, 50 });
		this.tablesOptimizationSchedule = new WeekDaySchedule(0, 0);

		this.smtpConnection = new SmtpConnection();
	}

	/*
	 * Checks if is jsf observer enabled.
	 *
	 * @return true, if is jsf observer enabled
	 */
	/**
	 * Checks if is jsf observer enabled.
	 *
	 * @return true, if is jsf observer enabled
	 */
	public boolean isJsfObserverEnabled() {
		return this.jsfObserverEnabled;
	}

	/**
	 * Sets the jsf observer enabled.
	 *
	 * @param jsfObserverEnabled the new jsf observer enabled
	 */
	public void setJsfObserverEnabled(boolean jsfObserverEnabled) {
		this.jsfObserverEnabled = jsfObserverEnabled;
	}

	/**
	 * Checks if is ejb observer enabled.
	 *
	 * @return true, if is ejb observer enabled
	 */
	public boolean isEjbObserverEnabled() {
		return this.ejbObserverEnabled;
	}

	/**
	 * Sets the ejb observer enabled.
	 *
	 * @param ejbObserverEnabled the new ejb observer enabled
	 */
	public void setEjbObserverEnabled(boolean ejbObserverEnabled) {
		this.ejbObserverEnabled = ejbObserverEnabled;
	}

	/**
	 * Checks if is servlet observer enabled.
	 *
	 * @return true, if is servlet observer enabled
	 */
	public boolean isServletObserverEnabled() {
		return this.servletObserverEnabled;
	}

	/**
	 * Sets the servlet observer enabled.
	 *
	 * @param servletObserverEnabled the new servlet observer enabled
	 */
	public void setServletObserverEnabled(boolean servletObserverEnabled) {
		this.servletObserverEnabled = servletObserverEnabled;
	}

	/**
	 * Checks if is custom observer enabled.
	 *
	 * @return true, if is custom observer enabled
	 */
	public boolean isCustomObserverEnabled() {
		return this.customObserverEnabled;
	}

	/**
	 * Sets the custom observer enabled.
	 *
	 * @param customObserverEnabled the new custom observer enabled
	 */
	public void setCustomObserverEnabled(boolean customObserverEnabled) {
		this.customObserverEnabled = customObserverEnabled;
	}

	/**
	 * Checks if is hard disk observer enabled.
	 *
	 * @return true, if is hard disk observer enabled
	 */
	public boolean isHardDiskObserverEnabled() {
		return this.hardDiskObserverEnabled;
	}

	/**
	 * Sets the hard disk observer enabled.
	 *
	 * @param hardDiskObserverEnabled the new hard disk observer enabled
	 */
	public void setHardDiskObserverEnabled(boolean hardDiskObserverEnabled) {
		this.hardDiskObserverEnabled = hardDiskObserverEnabled;
	}


	/**
	 * Checks if is http session observer enabled.
	 *
	 * @return true, if is http session observer enabled
	 */
	public boolean isHttpSessionObserverEnabled() {
		return this.httpSessionObserverEnabled;
	}

	/**
	 * Sets the http session observer enabled.
	 *
	 * @param httpSessionObserverEnabled the new http session observer enabled
	 */
	public void setHttpSessionObserverEnabled(boolean httpSessionObserverEnabled) {
		this.httpSessionObserverEnabled = httpSessionObserverEnabled;
	}

	/**
	 * Checks if is jvm observer enabled.
	 *
	 * @return true, if is jvm observer enabled
	 */
	public boolean isJvmObserverEnabled() {
		return this.jvmObserverEnabled;
	}

	/**
	 * Sets the jvm observer enabled.
	 *
	 * @param jvmObserverEnabled the new jvm observer enabled
	 */
	public void setJvmObserverEnabled(boolean jvmObserverEnabled) {
		this.jvmObserverEnabled = jvmObserverEnabled;
	}

	/**
	 * Gets the jvm exclusion rules list.
	 *
	 * @return the jvm exclusion rules list
	 */
	public List<JvmExclusionRule> getJvmExclusionRulesList() {
		return this.jvmExclusionRulesList;
	}

	/**
	 * Sets the jvm exclusion rules list.
	 *
	 * @param jvmExclusionRulesList the new jvm exclusion rules list
	 */
	public void setJvmExclusionRulesList(List<JvmExclusionRule> jvmExclusionRulesList) {
		this.jvmExclusionRulesList = jvmExclusionRulesList;
	}

	/**
	 * Gets the jvm notification rules list.
	 *
	 * @return the jvm notification rules list
	 */
	public List<JvmNotificationRule> getJvmNotificationRulesList() {
		return this.jvmNotificationRulesList;
	}

	/**
	 * Sets the jvm notification rules list.
	 *
	 * @param jvmNotificationRulesList the new jvm notification rules list
	 */
	public void setJvmNotificationRulesList(List<JvmNotificationRule> jvmNotificationRulesList) {
		this.jvmNotificationRulesList = jvmNotificationRulesList;
	}

	/**
	 * Gets theaction exclusion rules list.
	 *
	 * @return theaction exclusion rules list
	 */
	public List<ActionExclusionRule> getActionExclusionRulesList() {
		return this.actionExclusionRulesList;
	}

	/**
	 * Sets theaction exclusion rules list.
	 *
	 * @param actionExclusionRulesList the newaction exclusion rules list
	 */
	public void setActionExclusionRulesList(List<ActionExclusionRule> actionExclusionRulesList) {
		this.actionExclusionRulesList = actionExclusionRulesList;
	}

	/**
	 * Gets theaction notification rules list.
	 *
	 * @return theaction notification rules list
	 */
	public List<ActionNotificationRule> getActionNotificationRulesList() {
		return this.actionNotificationRulesList;
	}

	/**
	 * Sets theaction notification rules list.
	 *
	 * @param actionNotificationRulesList the newaction notification rules list
	 */
	public void setActionNotificationRulesList(List<ActionNotificationRule> actionNotificationRulesList) {
		this.actionNotificationRulesList = actionNotificationRulesList;
	}

	/**
	 * Gets the http session exclusion rules list.
	 *
	 * @return the http session exclusion rules list
	 */
	public List<HttpSessionExclusionRule> getHttpSessionExclusionRulesList() {
		return this.httpSessionExclusionRulesList;
	}

	/**
	 * Sets the http session exclusion rules list.
	 *
	 * @param httpSessionExclusionRulesList the new http session exclusion rules list
	 */
	public void setHttpSessionExclusionRulesList(List<HttpSessionExclusionRule> httpSessionExclusionRulesList) {
		this.httpSessionExclusionRulesList = httpSessionExclusionRulesList;
	}

	/**
	 * Gets the http session notification rules list.
	 *
	 * @return the http session notification rules list
	 */
	public List<HttpSessionNotificationRule> getHttpSessionNotificationRulesList() {
		return this.httpSessionNotificationRulesList;
	}

	/**
	 * Sets the http session notification rules list.
	 *
	 * @param httpSessionNotificationRulesList the new http session notification rules list
	 */
	public void setHttpSessionNotificationRulesList(List<HttpSessionNotificationRule> httpSessionNotificationRulesList) {
		this.httpSessionNotificationRulesList = httpSessionNotificationRulesList;
	}

	/**
	 * Gets theaction max storage period.
	 *
	 * @return theaction max storage period
	 */
	public TimePeriod getActionMaxStoragePeriod() {
		return this.actionMaxStoragePeriod;
	}

	/**
	 * Sets theaction max storage period.
	 *
	 * @param actionMaxStoragePeriod the newaction max storage period
	 */
	public void setActionMaxStoragePeriod(TimePeriod actionMaxStoragePeriod) {
		this.actionMaxStoragePeriod = actionMaxStoragePeriod;
	}

	/**
	 * Gets the http session max storage period.
	 *
	 * @return the http session max storage period
	 */
	public TimePeriod getHttpSessionMaxStoragePeriod() {
		return this.httpSessionMaxStoragePeriod;
	}

	/**
	 * Gets the jvm max storage period.
	 *
	 * @return the jvm max storage period
	 */
	public TimePeriod getJvmMaxStoragePeriod() {
		return this.jvmMaxStoragePeriod;
	}

	/**
	 * Gets the smtp connection.
	 *
	 * @return the smtp connection
	 */
	public SmtpConnection getSmtpConnection() {
		return this.smtpConnection;
	}

	/**
	 * Gets the tables optimization schedule.
	 *
	 * @return the tables optimization schedule
	 */
	public TimeSchedule getTablesOptimizationSchedule() {
		return this.tablesOptimizationSchedule;
	}

	/**
	 * Sets the smtp connection.
	 *
	 * @param smtpConnection the new smtp connection
	 */
	public void setSmtpConnection(SmtpConnection smtpConnection) {
		this.smtpConnection = smtpConnection;
	}

	/**
	 * Sets the tables optimization schedule.
	 *
	 * @param tablesOptimizationSchedule the new tables optimization schedule
	 */
	public void setTablesOptimizationSchedule(TimeSchedule tablesOptimizationSchedule) {
		this.tablesOptimizationSchedule = tablesOptimizationSchedule;
	}

	/**
	 * Gets the tables clean schedule.
	 *
	 * @return the tables clean schedule
	 */
	public TimeSchedule getTablesCleanSchedule() {
		return this.tablesCleanSchedule;
	}

	/**
	 * Sets the tables clean schedule.
	 *
	 * @param tablesCleanSchedule the new tables clean schedule
	 */
	public void setTablesCleanSchedule(TimeSchedule tablesCleanSchedule) {
		this.tablesCleanSchedule = tablesCleanSchedule;
	}

	/**
	 * Gets the hard disk exclusion rules list.
	 *
	 * @return the hard disk exclusion rules list
	 */
	public List<HardDiskExclusionRule> getHardDiskExclusionRulesList() {
		return this.hardDiskExclusionRulesList;
	}

	/**
	 * Sets the hard disk exclusion rules list.
	 *
	 * @param hardDiskExclusionRulesList the new hard disk exclusion rules list
	 */
	public void setHardDiskExclusionRulesList(List<HardDiskExclusionRule> hardDiskExclusionRulesList) {
		this.hardDiskExclusionRulesList = hardDiskExclusionRulesList;
	}

	/**
	 * Gets the hard disk max storage period.
	 *
	 * @return the hard disk max storage period
	 */
	public TimePeriod getHardDiskMaxStoragePeriod() {
		return this.hardDiskMaxStoragePeriod;
	}

	/**
	 * Sets the hard disk max storage period.
	 *
	 * @param hardDiskMaxStoragePeriod the new hard disk max storage period
	 */
	public void setHardDiskMaxStoragePeriod(TimePeriod hardDiskMaxStoragePeriod) {
		this.hardDiskMaxStoragePeriod = hardDiskMaxStoragePeriod;
	}

	/**
	 * Gets the hard disk notification rules list.
	 *
	 * @return the hard disk notification rules list
	 */
	public List<HardDiskNotificationRule> getHardDiskNotificationRulesList() {
		return this.hardDiskNotificationRulesList;
	}

	/**
	 * Sets the hard disk notification rules list.
	 *
	 * @param hardDiskNotificationRulesList the new hard disk notification rules list
	 */
	public void setHardDiskNotificationRulesList(List<HardDiskNotificationRule> hardDiskNotificationRulesList) {
		this.hardDiskNotificationRulesList = hardDiskNotificationRulesList;
	}
}
